#include "maincontroller.h"


MainController *MainController::s_instance = nullptr;
MainController::MainController()
                : m_mainlayoutView(nullptr)
                , m_mainView(nullptr)
                , m_studentView(nullptr)
{

}

MainController *MainController::getInstance()
{
    if(s_instance == nullptr)
    {
        s_instance = new MainController();
    }
    return s_instance;
}

void MainController::initMainLayoutView(MainLayoutView *view)
{
    m_mainlayoutView = view;
}

void MainController::showMainLayoutView()
{
    if(nullptr != m_mainlayoutView)
    {
        m_mainlayoutView->show();
    }
}

void MainController::hideMainLayoutView()
{
    if(nullptr != m_mainlayoutView)
    {
        m_mainlayoutView->hide();
    }
}

void MainController::showMainView()
{
    if(m_mainView == nullptr)
    {
        m_mainView = new MainWindow();
    }
    m_mainView->show();
}

void MainController::hideMainView()
{
    if(nullptr != m_mainView)
    {
        m_mainView->hide();
    }
}

void MainController::showStudentView()
{
    if (nullptr == m_studentView)
    {
       m_studentView = new StudentView();
    }
       m_studentView->show();
}

void MainController::hideStudentView()
{
    if (nullptr != m_studentView)
    {
        m_studentView->hide();
    }
}
